package behavior.strategy;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author lzp
 * @Date:2023/3/7
 * @description: 会员折扣
 */
public class PrimeDiscountStrategy implements DiscountStrategy{
	@Override
	public BigDecimal getDiscount(BigDecimal total) {
		// 满100-20 之后再打7折
		return (total.compareTo(BigDecimal.valueOf(100)) >= 0 ? BigDecimal.valueOf(20) : BigDecimal.ZERO)
				.multiply(new BigDecimal("0.7")).setScale(2, RoundingMode.DOWN);
	}
}
